//
//  BaseViewController.m
//  Masory使用
//
//  Created by 周成龙 on 16/10/25.
//  Copyright © 2016年 ZCL. All rights reserved.
//

#import "BaseViewController.h"
#import "Masonry.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self initView];
}

- (void)initView {
    
    UIView *bgView = [[UIView alloc] init];
    bgView.frame = CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64);
    bgView.backgroundColor = [UIColor orangeColor];
    [self.view addSubview:bgView];
    
    UIView *greenView = UIView.new;
    greenView.backgroundColor = UIColor.greenColor;
    greenView.layer.borderColor = UIColor.blackColor.CGColor;
    greenView.layer.borderWidth = 2;
    [bgView addSubview:greenView];
    
    UIView *redView = UIView.new;
    redView.backgroundColor = UIColor.redColor;
    redView.layer.borderColor = UIColor.blackColor.CGColor;
    redView.layer.borderWidth = 2;
    [bgView addSubview:redView];
    
    UIView *blueView = UIView.new;
    blueView.backgroundColor = UIColor.blueColor;
    blueView.layer.borderColor = UIColor.blackColor.CGColor;
    blueView.layer.borderWidth = 2;
    [bgView addSubview:blueView];
    
    UIView *superview = bgView;
    int padding = 10;
    
    
    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(superview).offset(padding);
        make.left.equalTo(superview).offset(padding);
        make.bottom.equalTo(superview).offset(-padding);
        make.right.equalTo(redView.mas_left).offset(-padding);
        
        make.width.equalTo(@[redView, blueView]);
    }];
    
    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(superview).offset(padding);
        make.left.equalTo(greenView.mas_right).offset(padding);
        make.bottom.equalTo(superview).offset(-padding);
        make.right.equalTo(blueView.mas_left).offset(-padding);
        
        make.width.equalTo(greenView);
    }];
    
    [blueView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(superview).offset(padding);
        make.left.equalTo(redView.mas_right).offset(padding);
        make.bottom.equalTo(superview).offset(-padding);
        make.right.equalTo(superview).offset(-padding);
        
        make.width.equalTo(greenView);
    }];
    
    
//    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(superview).offset(padding);
//        make.left.equalTo(superview).offset(padding);
//        make.bottom.equalTo(blueView.mas_top).offset(-padding);
//        make.right.equalTo(redView.mas_left).offset(-padding);
//        
//        make.width.equalTo(redView.mas_width);
//        make.height.equalTo(redView.mas_height);
//        make.height.equalTo(greenView.mas_height);
//    }];
//    
//    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(superview).offset(padding);
//        make.left.equalTo(greenView.mas_right).offset(padding);
//        make.bottom.equalTo(blueView.mas_top).offset(-padding);
//        make.right.equalTo(superview).offset(-padding);
//        
//        make.width.equalTo(greenView.mas_width);
//        make.height.equalTo(@[greenView, blueView]);
//    }];
//    
//    [blueView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(greenView.mas_bottom).offset(padding);
//        make.left.equalTo(superview).offset(padding);
//        make.bottom.equalTo(superview).offset(-padding);
//        make.right.equalTo(superview).offset(-padding);
//        
//        make.height.equalTo(@[greenView.mas_height, redView.mas_height]);
//    }];
}


@end
